package com.glsc.ngateway.common.base.dto.cmdb;


import cn.hutool.core.annotation.Alias;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import org.apache.commons.lang.StringUtils;

/**
 * cpu,内存,硬盘,配件详情导入 数据结构
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@JsonInclude
@SuperBuilder
public class CmdbCommonDetailImportDto {

    @Alias(value = "规格配件号")
    @ApiModelProperty(value = "规格配件号")
    private String partNum;

    @Alias(value = "序列号")
    @ApiModelProperty(value = "序列号")
    private String sn;

    @Alias(value = "生产日期")
    @ApiModelProperty(value = "生产日期")
    private String manufactDate;

    @Alias(value = "过保日期")
    @ApiModelProperty(value = "过保日期")
    private String expirateDate;

    @Alias(value = "机房")
    @ApiModelProperty(value = "机房")
    private String machineRoom;

    @Alias(value = "购置日期")
    @ApiModelProperty(value = "购置日期")
    private String purchaseDate;

    @Alias(value = "入库单价（含税）")
    @ApiModelProperty(value = "入库单价（含税）")
    private String inputPriceWithTax;

    @Alias(value = "不含税金额")
    @ApiModelProperty(value = "不含税金额")
    private String inputPriceNoTax;

    @Alias(value = "使用人")
    @ApiModelProperty(value = "使用人")
    private String user;



    //郑依然起的机房id名字
    @ApiModelProperty(value = "机房id")
    private Integer locationId;



    public String getPurchaseDate() {
        if (StringUtils.isNotBlank(purchaseDate)) {
            return purchaseDate.substring(0, 10);
        }
        return null;
    }

    public String getManufactDate() {
        if (StringUtils.isNotBlank(manufactDate)) {
            return manufactDate.substring(0, 10);
        }
        return null;
    }

    public String getExpirateDate() {
        if (StringUtils.isNotBlank(expirateDate)) {
            return expirateDate.substring(0, 10);
        }
        return null;
    }

}
